<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
    <title>添加用户</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <link href="__PUBLIC__/css/mine.css" rel="stylesheet" type="text/css"/>
    <script src="__PUBLIC__/js/jquery.min.js"></script>

    <script src="__PUBLIC__/js/check.js"></script>
    <script language=javascript>
        function $(id) {
            return document.getElementById(id);
        }
        //提交时进行验证
        function check(){
            //验证用户名是否为空
            var mg_name = $("mg_name").value;
            $("mg_nameinfo").innerHTML = "";
            if(name == "") {
                $("mg_nameinfo").innerHTML = "姓名不能为空！";
                $("mg_name").focus();
                return false;
            }
            //提交时验证密码
            var mg_pwd = $("mg_pwd").value;
            $("mg_pwdinfo").innerHTML = "";
            if(mg_pwd == "") {
                $("mg_pwdinfo").innerHTML = "不能为空!";
                $("mg_pwd").focus();
                return false;
            }
            if(mg_pwd.length < 6) {
                $("mg_pwdinfo").innerHTML = "密码长度必须大于或者等于6！";
                $("mg_pwd").focus();
                return false;
            }
            //提交时验证重输密码
            var mg_pwd = $("mg_pwd").value;
            var mg_repwd = $("mg_repwd").value;

            $("mg_repwdinfo").innerHTML = "";
            if(mg_repwd != mg_pwd) {
                $("mg_repwdinfo").innerHTML = "两次输入的密码不一致！";
                return false;
            }
            //提交时验证公司名称
            var mg_com = $("mg_com").value;
            $("mg_cominfo").innerHTML = "";
            if(mg_com == "") {
                $("mg_cominfo").innerHTML = "不能为空!";
                $("mg_com").focus();
                return false;
            }
        }

        //失去焦点是验证用户名是否为空
        function checkName() {  //校验姓名
            $('mg_nameinfo').innerHTML = "";
            var mg_name = $('mg_name').value;
            if(mg_name == "") {
                $("mg_nameinfo").innerHTML = "用户名不能为空！";
                return false;
            }
        }
        //失去焦点是验证密码是否为空以及长度是否满足要求
        function checkPassword() {  //校验密码
            $('mg_pwdinfo').innerHTML = "";
            var mg_pwd = $('mg_pwd').value;
            if(mg_pwd == "") {
                $("mg_pwdinfo").innerHTML = "密码不能为空！";
                return false;
            }

            if(mg_pwd.length < 6) {
                $("mg_pwdinfo").innerHTML = "密码长度必须大于或者等于6！";
                return false;
            }
        }
        //失去焦点时验证重输密码
        function checkRepassword() {
            $('mg_repwdinfo').innerHTML = "";
            var mg_repwd = $('mg_repwd').value;
            var mg_pwd = $('mg_pwd').value;
            if(mg_repwd != mg_pwd) {
                $("mg_repwdinfo").innerHTML = "两次输入的密码不一致!";
                return false;
            }
        }
    </script>
</head>

<body>

<div class="div_head">
            <span>
                <span style="float:left">当前位置是：管理员管理-》添加管理员</span>
                <span style="float: right; margin-right: 8px; font-weight: bold;">
                    <a style="text-decoration: none;" href="__MODULE__/Manager/showlist">【返回管理员列表】</a>
                </span>
            </span>
</div>
<div></div>

<div style="font-size: 13px;margin: 10px 5px">

    <form action="__SELF__" method="post" enctype="multipart/form-data"
          name="myForm"onsubmit="return check()">
        <table border="1" width="100%" class="table_a">
            <tr>
                <td width="20%">用户名</td>
                <td><input type="text" name="mg_name" id="mg_name" style="line-height:20px" onblur="checkName();" autofocus="autofocus"/><span id="mg_nameinfo"></span></td>
            </tr>
            <tr>
                <td>密码</td>
                <td><input type="password" name="mg_pwd"id="mg_pwd" onblur="checkPassword()"/><span id="mg_pwdinfo"></span></td>
            </tr>
            <tr>
                <td>重输密码</td>
                <td><input type="password" name="mg_repwd"id="mg_repwd" onblur="checkRepassword()"/><span id="mg_repwdinfo"></span></td>
            </tr>
            <tr>
                <td>所在企业名称</td>
                <td><input type="text" name="mg_com" id="mg_com" onblur="checkEmpty(this)"/><span id="mg_cominfo"></span>&nbsp;(*请确保不要和之前公司名称有重复否则添加失败！)

                </td>
            </tr>

            <tr>
                <td>角色</td>
                <td>
                    <select name='mg_role_id'>
                        <option value='0'>请选择</option>
                        <foreach name="rinfo" item="val">
                            <option value="{$key}">{$val}</option>
                        </foreach>
                        <!--{html_options options=$rinfo selected=$role_id}-->
                    </select>
                </td>
            </tr>

            <tr>
                <td colspan="2" align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="submit" value="保存" style="color:blue;font-weight: bold">
                </td>
            </tr>
        </table>
    </form>
</div>
</body>
</html>
